<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<%@include file="/context/mytags.jsp"%>
<head>
<title>${fns:getSysName('productName')}</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE8" />
<t:base type="jquery,jqueryui,cookie,barn,bootstrap,app,lhgDialog"></t:base>
<script>
$(function(){
	$.post("sysRoleController.do?dataContext",function(reslut){
		var data = $.parseJSON(reslut);
		var str ='<div class="c_center"><ul>';
		for (var i = 0; i < data.length; i++) {
			str+='<li class="r_list"><div class="role"><div class="r_left"><input type="checkbox" data-id="'+data[i].obj.id+'"/><b>'+data[i].obj.roleName+'</b></div>';
			str+='<div class="r_center">';
			var funcList = data[i].objList1;
			for(var f = 0; f < funcList.length; f++){
				str+=funcList[f].funcName+' ';
			}
			str+='</div><div class="r_right"><a href="">创建账号</a></div><div class="clr"></div></div>';
			str+=' <div class="account"><ul>';
			var userList = data[i].objList2;
			for (var u = 0; u < userList.length; u++) {
				str+='<li class="a_list"><div class="a_left">'+userList[u].userName+'</div><div class="a_center">P1 P2 P3 P4 P5</div>';
				str+='<div class="a_right"><a href="" class="ck" title="查看"></a><a href="" class="xg" title="修改"></a><a href="" class="sc" title="删除"></a></div></li><div class="clr"></div>';
			}
			str+='</ul></div>';
		}
		str+='</ul></div>';
		$('body').append(str);
		
		//checkbox控制
		$(":checkbox").click(function(){
			var e = $(this);
			$(":checkbox").each(function(){
				if($(this).data("id")!= e.data("id") && $(this).is(":checked"))
					$(this).attr("checked",false);
			});
		});
		
		$(".cview").click(function(e){
			e.preventDefault();
			if($(":checkbox").attr("checked") =='checked'){
				alert($(":checkbox").data("id"));
			}else{
				alert("请先选择角色");
			}
			
		});
		
		$(".cmodify").click(function(e){
			e.preventDefault();
			if($(":checkbox").attr("checked") =='checked'){
				alert($(":checkbox").data("id"));
			}else{
				alert("请先选择角色");
			}
			
		});
		$(".cdel").click(function(e){
			e.preventDefault();
			if($(":checkbox").attr("checked") =='checked'){
				alert($(":checkbox").data("id"));
			}else{
				alert("请先选择角色");
			}
			
		});
		
		$(".cadd").click(function(){
			title = $(this).text();
			$('body').dialog({
					id:'id1',
			        title: title,
			        height : $(window).height() - 200,
			        width : $(window).width() - 600,
			        max:false,
			        min:false,
			        content:'url:',
			        ok:function(){
			        	
			        }
		    });
			
		});
	});
});
</script>
</head>
<body>
	 <!-----------人员管理 s--------------------->
    <div class="C_top">
      <a href="javascript:" class="cadd">创建角色</a>
      <a href="javascript:" class="cview">角色信息查看</a>
      <a href="javascript:" class="cmodify">角色信息修改</a>
      <a href="javascript:" class="cdel">角色删除</a>
    </div><!--C_top e-->
 <!-----------人员管理 e--------------------->
</body>
</html>